#ifndef H_MAINWINDOW
#define H_MAINWINDOW
#include "precompiled.h"
#include "ui_mainwindow.h"
#include "itemcombobox.h"
#include "loadchardialog.h"
#include "eqvdialog.h"
#include "buffsdialog.h"
#include "graphwidget.h"
#include "bwlistdialog.h"
#include "filteritemsdialog.h"
#include "conditionsdialog.h"
#include "engine/engineheader.h"
#include "engine/httpget.h"
namespace weo
{
    namespace ui
    {
        class MainWindow : public QMainWindow, protected Ui_MainWindow
        {
            Q_OBJECT
        private:
            QVector<QLabel*> m_SlotLabels;
            QVector<QLabel*> m_GemLabels;
            QVector<QLabel*> m_EnchantLabels;
            QVector<ItemComboBox<weo::engine::item::Item>*> m_SlotCboxes;
            QVector<ItemComboBox<weo::engine::item::Item>*> m_GemCboxes;
            QVector<ItemComboBox<weo::engine::item::Enchant>*> m_EnchantCboxes;
            QVector<QCheckBox*> m_LockCheckBoxes;	
            GraphWidget* m_GraphWidget;
            std::vector<std::vector<const weo::engine::item::Item*>> m_Items;
            int loadData();
            void populateBoxes();
            weo::engine::character::Character *m_Character;
            weo::engine::optimization::Optimization *m_Optimizer;
            void EndNotify();
            void UpdateNotify(float value);
            void UpdateData();
            void UpdateData(const weo::engine::character::Equipment& equip);
            bool m_OptimizeRunning;
            bool m_Locked;
            bool m_Locks[weo::engine::Slotcount];
            void OutputAttributes(const weo::engine::character::Equipment& equip);
            void populateGemBoxes(int number, const weo::engine::item::Item* item);
            void populateEnchantBox(int number,const weo::engine::item::Item* item);
            void handleButtons(bool enable);
            bool event(QEvent *event);
            const weo::engine::character::Equipment getCurrentEquip();
            boost::mutex m_Mutex;
            private slots:
                void on_OptimizationButton_clicked();
                void on_CopyButton_clicked();
                void on_LoadButton_clicked();
                void on_SaveButton_clicked();
                void on_EQVButton_clicked();
                void on_BuffsButton_clicked();
                void on_FilterButton_clicked();
                void on_BWListButton_clicked();
                void on_ConditionsButton_clicked();
                void LockBox_checked(int state);
                void SlotCBox_currentIndexChanged(int index);
                void UpdateTV(int index);
                void on_ClassCBox_currentIndexChanged(const QString &text);
                void on_BuildCBox_currentIndexChanged(const QString &text);
        public:
            MainWindow(QWidget* parent = 0, Qt::WFlags flags = 0);
            virtual ~MainWindow();

        };
    };
};
#endif